using System;
using Newtonsoft.Json;

namespace FBGraph.Models
{
    /// <summary>A comment on a <see cref="Post" />, <see cref="Note" />, <see cref="Photo" />, <see cref="Album" /> or <see cref="Video" /></summary>
    public partial class Comment : IFBGraphResult
    {
        /// <summary>The Graph API id of the comment</summary>
        [JsonPropertyAttribute("id")]
        public String Id { get; set; }
        
        /// <summary>A <see cref="From" /> object describing the <see cref="User" /> or <see cref="Page" /> that posted the comment</summary>
        [JsonPropertyAttribute("from")]
        public From From { get; set; }
        
        /// <summary>The text of the comment</summary>
        [JsonPropertyAttribute("message")]
        public String Message { get; set; }
        
        /// <summary>The date and time that the comment was created</summary>
        [JsonPropertyAttribute("created_time")]
        public DateTime CreatedTime { get; set; }
        
        /// <summary>Gets or sets a <see cref="Boolean" /> value representing whether the object has been populated.</summary>
        Boolean IFBGraphResult.IsReady { get; set; }
        /// <summary>Updates the current model with values from another like-typed model.</summary>
        /// <param name="other">The source model.</param>
        /// <remarks>This is used for asynchronous calls to update the reference that was returned when the original API method was called.</remarks>
        void IFBGraphResult.UpdateFrom(IFBGraphResult other)
        {
            var that = other as Comment;
            if (that == null) return;
            else
            {
                this.Id = that.Id;
                this.From = that.From;
                this.Message = that.Message;
                this.CreatedTime = that.CreatedTime;
                ((IFBGraphResult)this).IsReady = true;
            }
            
        }
    }
}